//
//  CreatAfterWorkMeetingViewController.m
//  TeamInformatization
//
//  Created by bigger on 2019/4/5.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "CreatAfterWorkMeetingViewController.h"
#import "MeetingMemberViewCell.h"
#import "SelectInputView.h"

@interface CreatAfterWorkMeetingViewController () <UICollectionViewDelegate, UICollectionViewDataSource>

@property (nonatomic, strong) UICollectionView *meetingMembersCollectionView;

@end

@implementation CreatAfterWorkMeetingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self showTitleBarWithTitle:@"创建班后会" leftButtonStyle:Base_NavigationBar_Back rightButtonStyle:Base_NavigationBar_None];
    
    // UI
    [self loadShowViews];
}

// UI
- (void)loadShowViews
{
    for (int i = 0; i < 2; i++) {
        SelectInputView *inputView = [[SelectInputView alloc] init];
        [self.view addSubview:inputView];
        
    }
    
    
    // 流水布局
    UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new];      //创建流水布局
    flowLayout.itemSize = CGSizeMake((kScreenWidth - 60 * kScaleWidth) / 3., 50 * kScaleWidth);      //设置每个格子的尺寸
    flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
    flowLayout.minimumLineSpacing = 0;        //设置每一行之间的间距
    flowLayout.minimumInteritemSpacing = 15 * kScaleWidth;
    flowLayout.headerReferenceSize = CGSizeMake(0, 0);
    flowLayout.footerReferenceSize = CGSizeMake(0, 0);
    flowLayout.sectionInset = UIEdgeInsetsMake(0, 15 * kScaleWidth, 0, 15 * kScaleWidth);
    
    self.meetingMembersCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, kSafeAreaTopHeight + 143 * kScaleWidth, kScreenWidth, 300 * kScaleWidth) collectionViewLayout:flowLayout];
    _meetingMembersCollectionView.backgroundColor = [UIColor whiteColor];
    _meetingMembersCollectionView.delegate = self;
    _meetingMembersCollectionView.dataSource = self;
    [_meetingMembersCollectionView registerClass:[MeetingMemberViewCell class] forCellWithReuseIdentifier:@"MeetingMember"];
    _meetingMembersCollectionView.bounces = NO;
    // 横向滑动
    _meetingMembersCollectionView.showsVerticalScrollIndicator = NO;
    _meetingMembersCollectionView.showsHorizontalScrollIndicator = NO;
    [self.view addSubview:_meetingMembersCollectionView];
    
    // 创建
    UIButton *startCreatButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [startCreatButton setCommonStyleAndShowText:@"开始创建"];
    [startCreatButton addTarget:self action:@selector(startCreatAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:startCreatButton];
    [startCreatButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-15 * kScaleWidth);
        make.centerX.mas_equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(kScreenWidth - 20 * kScaleWidth, 44 * kScaleWidth));
    }];
    
}


#pragma mark - CollectionViewDelegate/DataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 10;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    MeetingMemberViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MeetingMember" forIndexPath:indexPath];
    
    return cell;
    
    
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    
}

// 创建
- (void)startCreatAction:(UIButton *)sender
{
    
}

#pragma -导航栏 两边按钮操作
-(void)baseNavigationBarLeftButtonClick:(UIButton *)button
{
    [self.navigationController popViewControllerAnimated:YES];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
